package com.cryptape.cita_wallet.activity;

import android.widget.TextView;

import com.alm.token.R;
import com.cryptape.cita_wallet.bean.MangoNodeBean;
import com.cryptape.cita_wallet.service.http.TokenService;

import rx.Subscriber;

;

/**
 * Created by dengming on 13/1/20.
 */

public class MangoNodeActivity extends NBaseActivity{
//    private List<MangoItemBean> mData = new ArrayList<>();
//    private MangoNodeBean mData;
    private TextView nodeName;
    private TextView allNodeNum;
    private TextView nowPool;
    private TextView yesterdayPool;

    @Override
    protected int getContentLayout() {
        return R.layout.activity_mango_node;
    }

    @Override
    protected void initView() {
//        mData.add(new MangoItemBean("MID11111","0x111111111111111"));
//        mData.add(new MangoItemBean("MID11111","0x111111111111111"));
//        mData.add(new MangoItemBean("MID11111","0x111111111111111"));
        allNodeNum = findViewById(R.id.allNodeNum);
        nodeName = findViewById(R.id.nodeName);
        nowPool  = findViewById(R.id.nowPool);
        yesterdayPool = findViewById(R.id.yesterdayPool);
    }

    @Override
    protected void initData() {
        TokenService.getTokgetMangoNode().subscribe(new Subscriber<MangoNodeBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(MangoNodeBean s) {
                if(s != null){
                    if(s.getCode() != 0){
                        return;
                    }
                    nodeName.setText(getString(R.string.Network_wide_P1)+s.getData().getNodeName());
                    allNodeNum.setText(s.getData().getAllNodeNum());
                    yesterdayPool.setText(getString(R.string.Bonus)+s.getData().getYesterdayPool());
                    nowPool.setText(s.getData().getNowPool());
                }
            }
        });
    }

    @Override
    protected void initAction() {

    }
}
